<?php session_start();
include("3.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="php, codigo fuente, codigo escrito, descarga gratis, AJAX, javascript, MySQL, scripts, rincondelcodigo, google maps" />
<meta name="ROBOTS" content="NOARCHIVE" />
<title>mapas google</title>
<!--www.rincondelcodigo.com-->
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAaOuNwQpl_6SNrN9SPqlprhQmVl4M6pUqpH8m1u86xCFJGE2ovxS4R4LhSaw6omab-H9GhhvM5WdLMw" type="text/javascript"></script>
</head>
<body id="home" onunload="GUnload()">
Este es el mapa de los usuarios geolocalizados.<br>
   <div id="map" style="width: 880px; height: 500px"></div>
  <div id="side_bar"></div>
    <script type="text/javascript">
    if (GBrowserIsCompatible()) {
      var side_bar_html = "";
      var gmarkers = [];
      var htmls = [];
      var i = 0;
      var gicons = [];
      gicons["map"] = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/red-pushpin.png");
	side_bar_html = '<span class="note">Usuarios geolocalizados: </span>';
      function createMarker(point,name,html,icontype) {
        var marker = new GMarker(point, gicons[icontype]);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        gmarkers[i] = marker;
        htmls[i] = html;
        side_bar_html += '<span class="note"><a href="javascript:myclick(' + i + ')">' + name + '<\/a><\/span> - ';
        i++;
        return marker;
      }
      function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(27.532960552771044,10.136716604232788), 2);
      var request = GXmlHttp.create();
      request.open("GET", "8.php", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = GXml.parse(request.responseText);
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var html = markers[i].getAttribute("html");
            var label = markers[i].getAttribute("label");
            var icontype = markers[i].getAttribute("icontype");
            var marker = createMarker(point,label,html,icontype);
            map.addOverlay(marker);
          }
          document.getElementById("side_bar").innerHTML = side_bar_html;
        }
      }
      request.send(null);
    }

    else {
      alert("El API de google maps no es compatible con este browser");
    }
    </script><br><br>
	<a href="4.php">volver</a><br>
	<a href="1.php">hacer otro registro</a>
	
</body></html>
